<?php

$booster_200 = 16*7;
$booster_100 = 11*7;

if ($argc!= 3) {
	die("Usage: $argv[0] filename1 filename2\r\n");
}

$lines1 = file($argv[1], FILE_IGNORE_NEW_LINES);
$lines2 = file($argv[2], FILE_IGNORE_NEW_LINES);

foreach($lines1 as $line) {
	$a = explode(',', $line);
	$name = $a[0];
	$strength = intval($a[1]);
	$user[$name] = $strength;
}

$napoleon = $caesar = 0;

foreach($lines2 as $line) {
	$a = explode(',', $line);
	$name = $a[0];
	$strength = intval($a[1]);
	if (array_key_exists($name, $user)) {
		$diff = abs($user[$name] - $strength);
		if ($diff >= $booster_200) {
			++$napoleon;
		} else if ($diff >= $booster_100) {
			++$caesar;
		}
	}
}

echo "napoleon = $napoleon\r\n";
echo "caesar = $caesar";

?>